<%@page import="model.User"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>

<jsp:include page="includes/header.jsp"></jsp:include>

<div id="maincontent">
	<%
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		String matkhaucu = "", matkhaumoi = "", re_matkhaumoi = "";
		String err_changepass = "", finish_changepass = "";
		String isLogin = "0";
		// Mật khẩu cũ
		if (request.getAttribute("matkhaucu") != null) {
			matkhaucu = (String) request.getAttribute("matkhaucu");
		}
		// Mật khẩu mới
		if (request.getAttribute("matkhaumoi") != null) {
			matkhaumoi = (String) request.getAttribute("matkhaumoi");
		}
		//Re mật khẩu mới
		if (request.getAttribute("re_matkhaumoi") != null) {
			re_matkhaumoi = (String) request.getAttribute("re_matkhaumoi");
		}
		//Lỗi mật khẩu 
		if (request.getAttribute("err_changepass") == null) {
			err_changepass = "";
		} else {
			err_changepass = (String) request
					.getAttribute("err_changepass");
		}
		//Thay đổi thành công
		if (request.getAttribute("finish_changepass") == null) {
			finish_changepass = "";
		} else {
			finish_changepass = (String) request
					.getAttribute("finish_changepass");
		}
	%>
	<%
		User user = new User();
		if (session.getAttribute("user") != null) {
			user = (User) session.getAttribute("user");
		}
		if (session.getAttribute("isLogin") != null) {
			isLogin = (String) session.getAttribute("isLogin");

		}
		if (isLogin.equalsIgnoreCase("0")) {
			request.setAttribute("err", "Bạn vui lòng đăng nhập trước!");
			RequestDispatcher rd = getServletContext()
					.getRequestDispatcher("/dangnhap.jsp");
			rd.forward(request, response);
		} else {
	%>

	<!--content_infomation-->
	<div id="content_infomation">
		<jsp:include page="includes/personleft.jsp"></jsp:include>


		<!--Right-->
		<form action="Xulydoimatkhau" method="post">
			<div id="infomation_right">
				<div class="title">THÔNG TIN ĐĂNG NHẬP</div>
				<div id="infouser">
					<div class="inforow">
						<label class="index">Email đăng nhập:</label>
						<div class="infotext">
							<label class="text"><%=user.getEmail()%></label>
						</div>
					</div>

					<div id="pwd" class="inforow">
						<label class="index">Mật khẩu</label>
						<div id="click-an-hien" style="cursor: pointer;">
							<span id="an-hiden" style="color: #008080;">Đổi mật khẩu</span>
						</div>
						<div class="infotext">*********</div>
					</div>
				</div>
				<label style="margin-left: 170px; color: red;"><%=err_changepass%></label>
				<label style="margin-left: 180px; color: green;"><%=finish_changepass%></label>
				<!--Update Mật Khẩu-->

				<div id="form-tdmk" style="display: none;">

					<label class="index_formtdmk">Mật khẩu hiện tại:</label>
					<div class="matkhaucu">
						<input class="txtmatkhaucu" type="password" name="matkhaucu"></input>
						<span class="required">*</span>

					</div>

					<!--End Mật khẩu cũ -->


					<label class="index_formtdmk">Mật khẩu
						mới:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
					<div class="matkhaucu">
						<input class="txtmatkhaucu" type="password" name="matkhaumoi"></input>
						<span class="required">*</span>
					</div>

					<!--End Mật khẩu mới -->


					<label class="index_formtdmk">Xác nhận mật khẩu</label>
					<div class="matkhaucu">
						<input class="txtmatkhaucu" type="password" name="re_matkhaumoi"></input>
						<span class="required">*</span>
					</div>

					<!--End xác nhận Mật khẩu mới -->

					<div id="submit">
						<input class="cnbq" type="submit" name="command" value="Cập nhật"></input>

					</div>

				</div>
			</div>
			<!--End Right-->
		</form>
	</div>
</div>
<jsp:include page="includes/footer.jsp"></jsp:include>

<%
	}
%>

